home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / shmem_broadcast.z / shmem_broadcast
Encoding:
Text File  |  2002-10-03  |  13.3 KB  |  194 lines

  1.  
  2. SHMEM_BROADCAST(3)                                       SHMEM_BROADCAST(3)
  3.  
  4.  
  5. NNNNAAAAMMMMEEEE
  6.      sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt4444, sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt8888, sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt33332222,
  7.      sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt66664444 - Broadcasts a block of data from one processing
  8.      element (PE) to one or more target PEs
  9.  
  10. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  11.      C or C++:
  12.  
  13.         ####iiiinnnncccclllluuuuddddeeee <<<<mmmmpppppppp////sssshhhhmmmmeeeemmmm....hhhh>>>>
  14.  
  15.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt33332222((((vvvvooooiiiidddd ****_t_a_r_g_e_t,,,, ccccoooonnnnsssstttt vvvvooooiiiidddd ****_s_o_u_r_c_e,,,, ssssiiiizzzzeeee____tttt
  16.         _n_l_o_n_g,,,, iiiinnnntttt _P_E__r_o_o_t,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,,
  17.         lllloooonnnngggg ****_p_S_y_n_c))));;;;
  18.  
  19.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt66664444((((vvvvooooiiiidddd ****_t_a_r_g_e_t,,,, ccccoooonnnnsssstttt vvvvooooiiiidddd ****_s_o_u_r_c_e,,,, ssssiiiizzzzeeee____tttt
  20.         _n_l_o_n_g,,,, iiiinnnntttt _P_E__r_o_o_t,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,,
  21.         lllloooonnnngggg ****_p_S_y_n_c))));;;;
  22.  
  23.      Fortran:
  24.  
  25.         IIIINNNNCCCCLLLLUUUUDDDDEEEE """"mmmmpppppppp////sssshhhhmmmmeeeemmmm....ffffhhhh""""
  26.  
  27.         IIIINNNNTTTTEEEEGGGGEEEERRRR _n_l_o_n_g,,,, _P_E__r_o_o_t,,,, _P_E__s_t_a_r_t,,,, _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e
  28.  
  29.         IIIINNNNTTTTEEEEGGGGEEEERRRR _p_S_y_n_c((((SSSSHHHHMMMMEEEEMMMM____BBBBCCCCAAAASSSSTTTT____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE))))
  30.  
  31.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____BBBBRRRROOOOAAAADDDDCCCCAAAASSSSTTTT4444((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__r_o_o_t,,,, _P_E__s_t_a_r_t,,,,
  32.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, ffffIIIIppppSSSSyyyynnnncccc))))
  33.  
  34.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____BBBBRRRROOOOAAAADDDDCCCCAAAASSSSTTTT8888((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__r_o_o_t,,,, _P_E__s_t_a_r_t,,,,
  35.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_S_y_n_c))))
  36.  
  37.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____BBBBRRRROOOOAAAADDDDCCCCAAAASSSSTTTT33332222((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__r_o_o_t,,,, _P_E__s_t_a_r_t,,,,
  38.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_S_y_n_c))))
  39.  
  40.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____BBBBRRRROOOOAAAADDDDCCCCAAAASSSSTTTT66664444((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__r_o_o_t,,,, _P_E__s_t_a_r_t,,,,
  41.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_S_y_n_c))))
  42.  
  43. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  44.      The shared memory (SHMEM) broadcast routines are collective routines.
  45.      They copy data object _s_o_u_r_c_e on the processor specified by _P_E__r_o_o_t and
  46.      store the values at _t_a_r_g_e_t on the other PEs specified by the triplet
  47.      _P_E__s_t_a_r_t, _l_o_g_P_E__s_t_r_i_d_e, _P_E__s_i_z_e.  The data is not copied to the target
  48.      area on the root PE.
  49.  
  50.      As with all SHMEM collective routines, each of these routines assumes
  51.      that only PEs in the active set call the routine.  If a PE not in the
  52.      active set calls a SHMEM collective routine, undefined behavior
  53.      results.
  54.  
  55.      The arguments are as follows:
  56.  
  57.      _t_a_r_g_e_t      A symmetric data object with one of the following data
  58.                  types:
  59.  
  60.                  RRRRoooouuuuttttiiiinnnneeee               DDDDaaaattttaaaa TTTTyyyyppppeeee aaaannnndddd LLLLaaaannnngggguuuuaaaaggggeeee
  61.  
  62.                  sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt8888, sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt66664444
  63.                                        Any noncharacter type that has an
  64.                                        element size of 64 bits.  No Fortran
  65.                                        derived types or C/C++ structures
  66.                                        are allowed.
  67.  
  68.                  sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt33332222     Any noncharacter type that has an
  69.                                        element size of 32 bits.  No Fortran
  70.                                        derived types or C/C++ structures
  71.                                        are allowed.
  72.  
  73.                  sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt4444      Any noncharacter type that has an
  74.                                        element size of 32 bits.
  75.  
  76.      _s_o_u_r_c_e      A symmetric data object that can be of any data type that
  77.                  is permissible for the _t_a_r_g_e_t argument.
  78.  
  79.      _n_l_o_n_g       The number of elements in _s_o_u_r_c_e.  For sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt33332222
  80.                  and sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt4444, this is the number of 32-bit
  81.                  halfwords.  _n_l_o_n_g must be of type integer.  If you are
  82.                  using Fortran, it must be a default integer value.
  83.  
  84.      _P_E__r_o_o_t     Zero-based ordinal of the PE, with respect to the active
  85.                  set, from which the data is copied.  Must be greater than
  86.                  or equal to 0 and less than PPPPEEEE____ssssiiiizzzzeeee.  _P_E__r_o_o_t must be of
  87.                  type integer.  If you are using Fortran, it must be a
  88.                  default integer value.
  89.  
  90.      _P_E__s_t_a_r_t    The lowest virtual PE number of the active set of PEs.
  91.                  _P_E__s_t_a_r_t must be of type integer.  If you are using
  92.                  Fortran, it must be a default integer value.
  93.  
  94.      _l_o_g_P_E__s_t_r_i_d_e
  95.                  The log (base 2) of the stride between consecutive virtual
  96.                  PE numbers in the active set.  _l_o_g__P_E__s_t_r_i_d_e must be of
  97.                  type integer.  If you are using Fortran, it must be a
  98.                  default integer value.
  99.  
  100.      _P_E__s_i_z_e     The number of PEs in the active set.  _P_E__s_i_z_e must be of
  101.                  type integer.  If you are using Fortran, it must be a
  102.                  default integer value.
  103.  
  104.      _p_S_y_n_c       A symmetric work array.
  105.  
  106.                  In C/C++, _p_S_y_n_c must be of type lllloooonnnngggg and size
  107.                  ____SSSSHHHHMMMMEEEEMMMM____BBBBCCCCAAAASSSSTTTT____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE.
  108.  
  109.                  In Fortran, _p_S_y_n_c must be of type integer and size
  110.                  SSSSHHHHMMMMEEEEMMMM____BBBBCCCCAAAASSSSTTTT____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE.
  111.  
  112.                  Every element of this array must be initialized with the
  113.                  value ____SSSSHHHHMMMMEEEEMMMM____SSSSYYYYNNNNCCCC____VVVVAAAALLLLUUUUEEEE (in C/C++) or SSSSHHHHMMMMEEEEMMMM____SSSSYYYYNNNNCCCC____VVVVAAAALLLLUUUUEEEE (in
  114.                  Fortran) before any of the PEs in the active set enter
  115.                  sssshhhhmmmmeeeemmmm____bbbbaaaarrrrrrrriiiieeeerrrr().
  116.  
  117.      The values of arguments _P_E__r_o_o_t, _P_E__s_t_a_r_t, _l_o_g_P_E__s_t_r_i_d_e, and _P_E__s_i_z_e
  118.      must be equal on all PEs in the active set.  The same _t_a_r_g_e_t and
  119.      _s_o_u_r_c_e data objects and the same _p_S_y_n_c work array must be passed to
  120.      all PEs in the active set.
  121.  
  122.      Before any PE calls a broadcast routine, you must ensure that the
  123.      following conditions exist (synchronization via a barrier or some
  124.      other method is often needed to ensure this):
  125.  
  126.      * The _p_S_y_n_c array on all PEs in the active set is not still in use
  127.        from a prior call to a broadcast routine.
  128.  
  129.      * The _t_a_r_g_e_t array on all PEs in the active set is ready to accept the
  130.        broadcast data.
  131.  
  132.      Upon return from a broadcast routine, the following are true for the
  133.      local PE:
  134.  
  135.      * If the current PE is not the root PE, the _t_a_r_g_e_t data object is
  136.        updated.
  137.  
  138.      * The data cache region that is mapped to the _t_a_r_g_e_t data object is
  139.        coherent.
  140.  
  141.      * The values in the _p_S_y_n_c array are restored to the original values.
  142.  
  143. NNNNOOOOTTTTEEEESSSS
  144.      The terms _c_o_l_l_e_c_t_i_v_e and _s_y_m_m_e_t_r_i_c are defined in iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3).
  145.  
  146.      All SHMEM broadcast routines restore _p_S_y_n_c to its original contents.
  147.      Multiple calls to SHMEM routines that use the same _p_S_y_n_c array do not
  148.      require that _p_S_y_n_c be reinitialized after the first call.
  149.  
  150.      You must ensure the that the _p_S_y_n_c array is not being updated by any
  151.      PE in the active set while any of the PEs participates in processing
  152.      of a SHMEM broadcast routine.  Be careful to avoid these situations:
  153.  
  154.      * If the _p_S_y_n_c array is initialized at run time, some type of
  155.        synchronization is needed to ensure that all PEs in the working set
  156.        have initialized _p_S_y_n_c before any of them enter a SHMEM routine
  157.        called with the _p_S_y_n_c synchronization array.
  158.  
  159.      * A _p_S_y_n_c array may be reused on a subsequent SHMEM broadcast routine
  160.        only if none of the PEs in the active set are still processing a
  161.        prior SHMEM broadcast routine call that used the same _p_S_y_n_c array.
  162.        In general, this can be ensured only by doing some type of
  163.        synchronization.  However, in the special case of SHMEM routines
  164.        being called with the same active set, you can allocate two _p_S_y_n_c
  165.        arrays and alternate between them on successive calls.
  166.  
  167. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  168.      In the following examples, the call to sssshhhhmmmmeeeemmmm____bbbbrrrrooooaaaaddddccccaaaasssstttt66664444 copies _s_o_u_r_c_e
  169.      on PE 4 to _t_a_r_g_e_t on PEs 5, 6, and 7.
  170.  
  171.      C/C++ example:
  172.  
  173.           for (i=0; i < _SHMEM_BCAST_SYNC_SIZE; i++) {
  174.                   pSync[i] = _SHMEM_SYNC_VALUE;
  175.           }
  176.           shmem_barrier_all(); /* Wait for all PEs to initialize pSync */
  177.           shmem_broadcast64(target, source, nlong, 0, 4, 0, 4, pSync);
  178.  
  179.      Fortran example:
  180.  
  181.            INTEGER PSYNC(SHMEM_BCAST_SYNC_SIZE)
  182.            INTEGER TARGET, SOURCE, NLONG, PE_ROOT, PE_START,
  183.       &      LOGPE_STRIDE, PE_SIZE, PSYNC
  184.            COMMON /COM/ TARGET, SOURCE
  185.  
  186.            DATA PSYNC /SHMEM_BCAST_SYNC_SIZE*SHMEM_SYNC_VALUE/
  187.  
  188.            CALL SHMEM_BROADCAST64(TARGET, SOURCE, NLONG, 0, 4, 0, 4, PSYNC)
  189.  
  190. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  191.      iiiinnnnttttrrrroooo____bbbbllllaaaaccccssss(3S), iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3)
  192.  
  193.      _M_e_s_s_a_g_e _P_a_s_s_i_n_g _T_o_o_l_k_i_t: _M_P_I _P_r_o_g_r_a_m_m_e_r'_s _M_a_n_u_a_l
  194.